global gAnsA, gAnsB, gAnsC, gGameBtn1, gGameBtn2, gGameBtn3, gGameBtn4, gBtn16, gBtn17
on birth me, pLevel, pTheWorld
if not(listp(gFullMasterRandomList)) then
set gFullMasterRandomList=[51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]
end if
if not(listp(gFullRandomList)) then
set gFullRandomList=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]
end if
mPrepGame me, pTheWorld
set iLevel=pLevel
set iSuspended=0
set vStartScores=[10,5,3,3]
set iMaskLocList=["A":190,"B":230,"C":270]
set iLiveGuys=getat(vStartScores,iLevel)
set iHalfLives=0
set iScore=0
set iFirstLifeSprite=2
set iFirstChipSprite=iFirstLifeSprite+10
set iLastQuestion=0
set iAnswered=0
set iQSprite=22
set iScoreSprite =23
set iLevSprite=28
mGetQList(me)
msetPuppets(me)
mSetLevel(me)
return me
end birth
on mPrepGame me, pTheWorld
set iWorld=pTheWorld
set iLifeCast=the number of cast "Large Boy Icon"
set iHalfCast=the number of cast "Small Boy Icon"
set iQCastStart=the number of cast "QuestionStart"
if listp(iChipList) then
repeat with x=1 to 10
set vChip=getat(iChiplist, x)
set vQuestionName=char 14 to 16 of the name of cast¼
(iQCastStart+getat(iActiveQuestionList,x))
mRedefineChipCast(vChip, vQuestionName)
end repeat
end if
end mPrepGame
on mSetPuppets me
repeat with x=1 to 10
set vSprite=(x-1)+iFirstLifeSprite
if not(the puppet of sprite vSprite) then puppetsprite vSprite, true
end repeat
end mSetPuppets
on mSetLevel me
puppetsprite iLevsprite, true
set vLevCast=the number of cast(char 1 of the moviename&".Level "&iLevel)
set the castnum of sprite iLevSprite=vLevCast
updatestage
end mSetLevel
on mRedrawChips me
repeat with x=1 to 10
set vChipToUpdate=getat(iChipList,x)
mUpdateChip(vChipToUpdate,0)
end repeat
end mRedrawChips
on mResumeGame me
mSetPuppets me
mSetLevel me
mRedrawChips me
mUpdateScore me
mShowBasicGameControls me
if iSuspended then
mShowQuestion me, iSuspended
puppetsprite 43, true
set vLastChip=getat(iChipList,iSuspended)
set vWrongAnswer=mGetWrongAnswer(vLastChip)
set the locv of sprite 43=getaprop(iMaskLocList, vWrongAnswer)
end if
end mResumeGame
on mShowBasicGameControls me
showcontrol(gGameBtn1)
showcontrol(gGameBtn2)
showcontrol(gGameBtn3)
showcontrol(gBtn16)
showcontrol(gBtn17)
end mShowBasicGameControls
-- GENERATE THE QUESTIONS TO BE USED IN THIS GAME
on mGetQList me
set iActiveQuestionList=[]
set iChipList=[]
set the randomseed=the timer
repeat with x=1 to 10
if iLevel>3 then
set vListLen=count(gFullMasterRandomList)
if (vListLen=0) or (vListlen<=count(iActiveQuestionList)) then
set gFullMasterRandomList=[51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]
end if
set vValid=false
repeat while vValid=false
set z=random(count(gFullMasterRandomList))
set y=getat(gFullMasterRandomList,z)
set vValid=not(mFindNumInList(me, y, iActiveQuestionList))
end repeat
else
set vListLen=count(gFullRandomList)
if (vListLen=0) or (vListlen<=count(iActiveQuestionList)) then
set gFullRandomList=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]
end if
set vValid=false
repeat while vValid=false
set z=random(count(gFullRandomLIst))
set y=getat(gFullRandomList,z)
set vValid=not(mFindNumInList(me, y, iActiveQuestionList))
end repeat
end if
add(iActiveQuestionList, y)
set vSprite=(x-1)+iFirstChipSprite
set vQCast=iQCastStart+y
set vTocLink=char 14 of the name of cast vQCast
if (iLevel=4) then put char 15 to 16 of (the name of cast vQCast) after vTocLink
set vNewChip=birth(script"chipClass", vSprite, x, vTOCLink)
add(iChipList, vNewChip)
mUpdateChip(vNewChip,0)
end repeat
end mGetQList
on mFindNumInList me, pNum, pList
set vListLen=count(pList)
set vInList=false
if vListLen>0 then
set vNumToCheck=1
repeat while (vNumToCheck<=vListLen) and not vInList
set vInList=(pNum=getat(pList, vNumTocheck))
set vNumToCheck=vNumToCheck+1
end repeat
end if
return vInList*(vNumToCheck-1)
end mFindNumInList
-- CHECK IF THE CLICKED ANSWER IS CORRECT
on mRightAnswer me, pAnswer, pQuestion
-- passed the answer letter submitted by the user and the question# (1-10) that has been answered
set vQuestionCast=getat(iActiveQuestionList, pQuestion)+iQCastStart
set vRightAnswer=char 13 of the name of cast vQuestionCast
put "Right Answer is:"&vRightAnswer
put "answer submitted is:"&pAnswer
return vRightAnswer=pAnswer
end mRightAnswer
on mUserAnswers me, pUserAnswer
-- puppetsound 0
-- set vSound=cast "Guess"
-- puppetsound vSound
-- updatestage
set vActiveChip=getat(iChipList, iLastQuestion)
sound close 2
if mRightAnswer(me, pUserAnswer, iLastQuestion) then
set vSound=cast "Right"
puppetsound vSound
set iAnswered=iAnswered+1
if (mGetChipState(vActiveChip)=3) then
set iHalfLives=iHalfLives-1
end if
set iScore=iScore+1
mSetChipState(vActiveChip,1)
else -- wrong answer
set vSound=cast "Wrong"
puppetsound vSound
put "Here's mgetchipstate:"&(mgetchipstate(vActiveChip))
mSetWrongAnswer(vActiveChip, pUserAnswer)
if iLevel=4 or (mGetChipState(vActiveChip)=3) then
if iLevel<>4 then
set iHalfLives=iHalfLives-1
end if
set iAnswered=iAnswered+1
set iLiveGuys=iLiveGuys-1
else -- the chip is going to go to TOC state
set iHalfLives=iHalfLives+1
end if
end if
-- if last question in master game then last chip can not go to TOC
if iAnswered=10 and iLevel=4 then
mFryLastChip(me)
end if
-- repeat while soundbusy(1)
-- end repeat
mUpdateScore me
repeat with x=1 to 500
updatestage
end repeat
mClearQuestion me, iLastQuestion
set vEndMovie=(char 1 of the moviename&"GMEND.DIR")
put vEndMovie
if iLiveGuys=0 then
TurnOffPuppets 1--APN 7/19
go frame "GameEnd0" of movie vEndMovie
else
if iAnswered=10 then
TurnOffPuppets 1--APN 7/19
if iScore>8 then
go frame ("GameEnd3") of movie vEndMovie
else
if iScore>4 then
go frame "GameEnd2" of movie vEndMovie
else -- score is less than 5
go frame "GameEnd1" of movie vEndMovie
end if
end if
end if
end if
end mUserAnswers
on mFryLastChip me
set vChipToFry = getat(iChiplist, iLastQuestion)
msetchipstate(vChipToFry,1)
end mFryLastChip
on mUpdateScore me
set vScoreString=iScore
if iScore<10 then put "0" before vScoreString
if not(the puppet of sprite iscoresprite) then puppetsprite iscoresprite,true
set the castnum of sprite iScoreSprite=the number of cast (iWorld&".Score "&vScoreString)
updatestage
mDrawLives me
end mUpdatescore
on mDrawLives me
set vFullGuys=iLiveGuys-iHalfLives
if vFullGuys<0 then set vFullGuys=0
if iLiveGuys<10 then
repeat with x=iLiveGuys+1 to 10
set vSprite=((x-1)+iFirstLifeSprite)
set the locv of sprite vSprite=880
updatestage
end repeat
end if
repeat with x= 1 to vFullGuys
set vSprite=((x-1)+iFirstLifeSprite)
set the loch of sprite vSprite=503-((x-1)*39)
set the locv of sprite vSprite=442
set the castnum of sprite vSprite=iLifeCast
updatestage
end repeat
if iHalfLives>0 then
set vBeginningLoc=503-((vFullGuys)*39)
repeat with x=1 to iHalfLives
set vSprite=((x-1)+iFirstLifeSprite)+vFullGuys
set the loch of sprite vSprite=vBeginningLoc-((x-1)*39)
set the locv of sprite vSprite=442
set the castnum of sprite vSprite=iHalfCast
updatestage
end repeat
end if
end mDrawLives
on mPrepClearBoard me
mClearLives me
mRestartChips me
end mPrepClearBoard
on mClearLives me
repeat with x=0 to 9
set vSpriteToFix=x+iFirstLifeSprite
if not(the puppet of sprite vSpriteToFix) then puppetsprite x, true
set the locv of sprite vSpriteToFix=880
updatestage
end repeat
end mClearLives
on mRestartChips me
repeat with x=1 to 10
set vChipToFlip=getat(iChipList, x)
mResetChip(vChipToFlip)
end repeat
end mRestartChips
on mClearChips me
repeat with x=1 to 10
set vChipToFlip=getat(iChipList, x)
mKillChip(vChipToFlip)
end repeat
end mClearChips
on mGetLevel me
return iLevel
end mGetLevel
on mGetChipList me
return iChipList
end mGetChiplist
on mGetWorld me
return iworld
end mGetWorld
on mShowQuestion me, pQNum
set x=cast "Whoosh"
puppetsound x
go frame "Questions"
puppetsprite iQSprite, true
set vCurrentQuestion=getat(iActiveQuestionList, pQNum)
set the castnum of sprite iQSprite=iQCastStart+vCurrentQuestion
updatestage
if iLastQuestion>0 then -- if in master game, opening a question kills last TOC chip